<script>
	export default {
		onLaunch: function() {
			 let roleList = [
				{key: 'admin', label:'总账户', value: 0},
				{key: 'quoter', label:'报价师', value: 1},
				{key: 'company', label:'门店公司', value: 2},
				{key: 'store', label:'店长', value: 3},
				{key: 'clerk', label:'店员', value: 4}
			]
			uni.getStorage({
				key: this.$constant.API_TOKEN,
				success: (reslut) => {
					if(reslut.data) {
						this.$request("/mobile/user/info", "get").then(res => {
							let userInfo = res.data
							userInfo.role = roleList[userInfo.type].key;
							uni.setStorageSync(this.$constant.TAB_INDEX, 0);
							uni.setStorageSync(this.$constant.ROLE_INFO_KEY, userInfo)
							
							uni.reLaunch({
								url:"/pages/index/index"
							})
						})
					}
				}
			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
	page {
		background-color: #f2f8fc;
	}
	.body_box {
		padding: 2vw;
	}
	/* 弹性布局 横向 */
	.row-box {
		display: flex;
		flex-direction: row;
	}
	.icon_img_max {
		width: 70rpx;
		height: 70rpx;
	}
	/* 正常图标大小 */
	.icon_img {
		width: 60rpx;
		height: 60rpx;
	}
	/* 小号图标大小 */
	.icon_img_mini{
		width: 50rpx;
		height: 50rpx;
	}
	/* 橘色 背景色 */
	.orange-bg-shadow {
		background-image: linear-gradient(#ffa054, #ff6746);
		box-shadow: #ffe2da 0 0 0 10rpx;
	}
	/* 蓝色 */
	.blue-bg-shadow {
		background-image: linear-gradient(#5fd3fe, #45bcff);
		box-shadow: #d9f2ff 0 0 0 10rpx;
	}
	/* 紫色 */
	.purple-bg-shadow {
		background-image: linear-gradient(#8093ff, #3b57ff);
		box-shadow: #dbe0ff 0 0 0 10rpx;
	}
	/* 浅蓝 */
	.light-blue-bg-shadow {
		background-image: linear-gradient(#85f8f6, #21d0e2);
		box-shadow: #d1f6f9 0 0 0 10rpx;
	}
	.yellow-bg-shadow {
		background-image: linear-gradient(#fbde7a, #fbac1e);
		box-shadow: #feeed3 0 0 0 10rpx;
	}
	.red-bg-shadow {
		background-image: linear-gradient(#fd6c92, #f54351);
		box-shadow: #fedde1 0 0 0 10rpx;
	}
	/* 深蓝 */
	.dark-blue-bg-shadow {
		background-image: linear-gradient(#77d0ff, #318aff);
		box-shadow: #ddefff 0 0 0 10rpx;
	}
	.center-box {
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.h2-font {
		font-size: 32rpx;
		font-weight: 900;
	}
	.h1-font {
		font-size: 36rpx;
		font-weight: 900;
	}
	.time-select-box {
		background-color: #fff;
		opacity: 0.8;
		margin-top: 50rpx;
		padding: 15rpx;
		border-radius: 20rpx;
		width: 36vw;
	}
	/* 权限图标样式 */
	.img-box {
		width: 76rpx;
		height: 76rpx;
		border-radius: 40rpx;
		margin-bottom: 10rpx;
	}
</style>
